#pragma once
#include <string>
#include "guichan/rectangle.hpp"

class AnimSet;
struct EntityDef;
class Controller;
struct Action;

class Entity
{
public:
	Entity();
	virtual ~Entity();
	virtual void update( int diff );
	virtual void render();
	virtual void render( int x, int y, int w=-1, int h=-1 );
	void renderBoundBox( );
	void renderHP( );
	virtual void init( EntityDef *def );
	gcn::Rectangle getCollsionBox( );
	gcn::Rectangle getBoundBox( );
	gcn::Rectangle getWeaponBox( );
	void setController( Controller *ctrl );
	void doAction( std::string actionname, bool forcereset = false );
	void setDirection( int direction );
	void setFaceDirection( int direction );
	void checkWeaponCollision( );
	void checkCollision( );
	int damage( Entity *src, int value );
	int getFootY( );

	int mID;
	float mX;
	float mY;
	float mLastX;
	float mLastY;
	int mLayer;
	int mDirection;  //move direction
	int mFaceDirection;
	float mMoveSpeed;
	int mHp;
	int mMaxHp;
	int mNoDmgTimer;
	AnimSet *mAnim;
	std::string mName;
	Action * mCurAction;
	EntityDef *mProto;
	gcn::Rectangle mLastCollision;

protected:
	Controller *mController;
};